package com.itbaizhan.shopping_search_service;

import com.baomidou.mybatisplus.annotation.DbType;
import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
import org.apache.dubbo.config.spring.context.annotation.EnableDubbo;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.context.annotation.Bean;

/**
 * 搜索服务启动类
 */
@EnableDiscoveryClient//向注册中心注册该服务
@EnableDubbo//启用dubbo功能
@RefreshScope// 配置动态刷新
@SpringBootApplication(exclude= {DataSourceAutoConfiguration.class})//忽略数据源配置
//@MapperScan("com.itbaizhan.shopping_search_service.mapper")
public class ShoppingSearchServiceApplication {

	public static void main(String[] args) {
		SpringApplication.run(ShoppingSearchServiceApplication.class, args);
	}
	
	// 分页插件
	@Bean
	public MybatisPlusInterceptor mybatisPlusInterceptor() {
		MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
		interceptor.addInnerInterceptor(new PaginationInnerInterceptor(DbType.MYSQL));
		return interceptor;
	}
}
